const organizationRouter = require('express').Router();
const orgapi = require('../api/organization')

organizationRouter.use('/echo',(req,res)=>{
    res.send({
        msg:"12321"
    })
})

organizationRouter.post('/addorganization',(req,res)=>{
    orgapi.createOrganization(req,res);
})
organizationRouter.post('/deleteorganization',(req,res)=>{
    orgapi.deleteOrganization(req,res);
})
organizationRouter.get('/organizationlist',(req,res)=>{
    orgapi.organizationList(req,res);
})
organizationRouter.get('/applicationList',(req,res)=>{
    orgapi.applicationList(req,res);
})
organizationRouter.post('/passapplication',(req,res)=>{
    orgapi.agreeJoins(req,res);
})
organizationRouter.post('/rejectapplication',(req,res)=>{
    orgapi.refuseJoins(req,res);
})
organizationRouter.get('/allorganizationlist',(req,res)=>{
    orgapi.allOrganizationList(req,res);
})
organizationRouter.get('/joinedorganizationlist',(req,res)=>{
    orgapi.joinedOrganizationList(req,res);
})
organizationRouter.post('/joinorganization',(req,res)=>{
    orgapi.joinOrganization(req,res);
})
organizationRouter.post('/quitorganization',(req,res)=>{
    orgapi.quitOrganization(req,res);
})

organizationRouter.use('*',(req,res)=>{
    res.send({
        msg:"无法联通"
    })
})

module.exports = {
    organizationRouter
}